<script setup lang="ts">
import KnowledgeList from '../Home/components/KnowledgeList.vue'
import { ref } from 'vue';
import FollowDoctor from '../Home/components/FollowDoctor.vue'
import { useConsultStore } from '@/stores';
import { ConsultType } from '@/enums';
// active 的值是 tab 的索引s
const active = ref(1)
const store = useConsultStore()


</script>

<template>
  <div class="home-page">
    <!-- 头部 -->
    <div class="home-header">
      <div class="con">
        <h1>健康百科</h1>
        <input type="text" placeholder="疾病/症状/医生/健身知识" class="search">
      </div>
    </div>
    <!-- 导航 -->
    <div class="home-navs">
      <div class="hot">
        <h3>热门话题</h3>
      </div>

      <van-row>
        <van-col span="6">
          <router-link to="/" class="nav min">
            <cp-icon name="home-order"></cp-icon>
            <p class="title">健康饮食</p>
          </router-link>
        </van-col>
        <van-col span="6">
          <router-link to="/" class="nav min">
            <cp-icon name="home-docs"></cp-icon>
            <p class="title">母婴</p>
          </router-link>
        </van-col>
        <van-col span="6">
          <router-link to="/" class="nav min">
            <cp-icon name="home-rp"></cp-icon>
            <p class="title">减脂</p>
          </router-link>
        </van-col>
        <van-col span="6">
          <router-link to="/" class="nav min">
            <cp-icon name="home-find"></cp-icon>
            <p class="title">运动</p>
          </router-link>
        </van-col>

      </van-row>
      <van-row>
        <van-col span="6">
          <router-link to="/" class="nav min">
            <cp-icon name="home-order"></cp-icon>
            <p class="title">慢性病</p>
          </router-link>
        </van-col>
        <van-col span="6">
          <router-link to="/" class="nav min">
            <cp-icon name="home-docs"></cp-icon>
            <p class="title">儿童健康</p>
          </router-link>
        </van-col>
        <van-col span="6">
          <router-link to="/" class="nav min">
            <cp-icon name="home-rp"></cp-icon>
            <p class="title">心理健康</p>
          </router-link>
        </van-col>
        <van-col span="6">
          <router-link to="/" class="nav min">
            <cp-icon name="home-find"></cp-icon>
            <p class="title">医学常识</p>
          </router-link>
        </van-col>
      </van-row>
    </div>

    <van-tabs shrink sticky v-model:active="active">
      <van-tab title="关注" name="like">

        <knowledge-list type="like" />
      </van-tab>
      <van-tab title="推荐">
        <knowledge-list type="recommend" />
      </van-tab>

    </van-tabs>
  </div>
</template>

<style lang="scss" scoped>
.home-page {
  padding-bottom: 50px;

}

.home-header {
  height: 90px;
  position: relative;

  &::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 90px;
    background: rgba(80, 163, 243),

  }

  .con {
    position: relative;
    padding: 0 15px;
    display: flex;
    top: 10px;
    align-items: center;
    justify-content: space-between;

    >h1 {
      font-size: 18px;
      color: #fff;
      font-weight: normal;
      padding: 20px 0;
      line-height: 1;
      padding-left: 5px;
    }

    .search {
      height: 40px;
      border-radius: 20px;
      box-shadow: 0px 15px 22px -7px rgba(224, 236, 250, 0.8);
      background-color: #fff;
      display: flex;
      align-items: center;
      padding: 0 20px;
      color: var(--cp-dark);
      font-size: 13px;
      opacity: 0.5;

      .cp-icon {
        font-size: 16px;
        margin-right: 5px;
      }
    }
  }
}

.home-navs {
  padding: 0;
  padding-top: 10px;

  .hot {

    padding: 10px 15px;
  }

  .nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0;

    .cp-icon {
      font-size: 48px;
    }

    .title {
      font-weight: 500;
      margin-top: 5px;
      color: var(--cp-text1);
    }

    .desc {
      font-size: 11px;
      color: var(--cp-tag);
      margin-top: 2px;
    }

    &.min {
      .cp-icon {
        font-size: 31px;
      }

      .title {
        font-size: 13px;
        color: var(--cp-text2);
        font-weight: normal;
      }
    }
  }
}


// 全局覆盖van-tab样式
.van-tabs {
  margin-top: 20px;

  .van-tabs__nav {
    padding: 0 0 15px 0;
  }

  .van-tabs__line {
    width: 20px;
    background-color: var(--cp-primary);
  }

  .van-tab {
    padding: 0 15px;
  }
}
</style>